<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <sj:head/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>EVON Global Logistics Solution</title>
<link href="./css/style.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript">

	document.getElementById("hiddebButton").style.display="none";
	document.getElementById("hiddebButtonParking").style.display="none"; 
	

	function displaySlots() {
		document.forms[0].action = 'ajaxAllocateParking';
		document.forms[0].submit();
	}

//$.subscribe('submitFormTopic', function(event,element) {
 //      alert('Successfully loaded first div');
        
 //       document.forms[0].action = 'populateOem';
  //      document.forms[0].submit();
   //  });

	
</script>
<body>
<sj:div id="carEntryDiv" cssClass="maincontent" indicator="indicator">
<h2>Please enter the car details / Chasis number to get the parking
allocation</h2>

<s:fielderror ></s:fielderror>
<s:actionerror/>
<s:actionmessage/>
<s:form id = "carEntryForm" action="carEntry" theme="simple">

<div id ="Tabone" class="subnavcontent">
	
	Select Yard : <s:select label="Select Yard" headerKey="-1"
		headerValue="Select Yard" list="listYard" listKey="id"
		listValue="name" name="selectedYardId" onchange="$.publish('submitFormTopic')"  />
		<!--
		onchange="populateOEM()" 
		-->
		
		<s:url var="populateOemUrl" action="populateOem" ></s:url>
		
		<sj:div id = "hiddebButton" >
			<sj:submit  formIds="carEntryForm"  href = "%{populateOemUrl}" listenTopics="submitFormTopic" targets="carEntryDiv"></sj:submit>
		</sj:div>
		
		<table width="100%" border="0" align="center" cellpadding="4" cellspacing="1" class="gridtable">
		</p>
		</br>
		<tr>
			<td width="15%">Chasis Number :</td>
			<td width="35%"><s:textfield
					name="carDTO.carChasisNumber" label="Chasis Number"
					value="%{carDTO.carChasisNumber}" /></td>
			<td width="15%">Manufacturer : </td>
			<td> 
				<s:select headerKey="-1" headerValue="Select OEM" list="listOem"
					listKey="id" listValue="name" name="selectedOemId" />
		</td>

		</tr>
		<tr></tr>
		<tr>
			<td width="15%">Model :</td>
			<td width="35%"><s:textfield name="carDTO.carModel"
				label="Model" value="%{carDTO.carModel}" /></td>
			<td width="15%">Car Number :</td>
			<td> 
				<s:textfield name="carDTO.carNumber" label="Car Number"
					value="%{carDTO.carNumber}" />
		</td>
		</tr>

		<tr>
			<td width="15%">Color :</td>
			<td width="35%"><s:textfield name="carDTO.carColor"
				label="Color" value="%{carDTO.carColor}" /></td>
			<td width="15%">Varient :</td>
			<td> 
				<s:textfield name="carDTO.carVerient"
					label="Varient" value="%{carDTO.carVerient}" />
		</td>
		</tr>

		<tr>
		<td width="15%">Key Number : </td>
			<td width="35%"><s:textfield
				name="carDTO.keyNumber" label="Key Number"
					value="%{carDTO.keyNumber}" /></td>
			<td width="15%"></td>
			<td ></td>
		</tr>
		<tr></tr>
		<tr></tr>
		<tr>
		<td width="15%">Section Name :</td>
			<td width="35%"> 
				<s:select headerKey="-1"
					headerValue="Select Section" list="listSection" listKey="id"
					listValue="name" name="selectedSectionId" onchange="$.publish('sectionSelectedTopic')"  />
				
			<s:url var="populateSlotUrl" action="ajaxAllocateParking" ></s:url>
		
			<sj:div id = "hiddebButtonParking" >
				<sj:submit  formIds="carEntryForm"  href = "%{populateSlotUrl}" listenTopics="sectionSelectedTopic" targets="carEntryDiv"></sj:submit>
			</sj:div>
			
			<td width="15%">Parking Slot : </td>
			<td><s:select headerKey="-1"
					headerValue="Select Parking" list="listParkingSlot" listKey="id"
					listValue="name" name="selectedParkingId"/></td>
			
		</tr>

		<tr>
		
			<td width="15%">Driver Name : </td>
			<td width="35%">
				<s:select label="Select Member"
					headerKey="-1" headerValue="Select Member" list="availableMembers"
					listKey="id" listValue="name" name="selectedMemberId" /></td>
			<td width="15%">Key Box : </td>
			<td> 
				<s:select label="Select Key Box"
					headerKey="-1" headerValue="Select Key Box" list="availableKeyBox"
					listKey="id" listValue="name" name="selectedKeyBoxId" />
		</td>
		</tr>
	</table>
	
	<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
		<tr>
		<td style="height:10px;"></td>
		</tr>
		<tr>
			
			<s:url var="parkingRequestUrl" action="carEntry" ></s:url>
				
			<td align="left"><sj:submit value="Parking Request"
				name="Parking Request"  cssClass="btnbg" formIds="carEntryForm" href = "%{parkingRequestUrl}" targets="carEntryDiv"/></td>
				
			<td align="left"><sj:submit value="Cancel" name="Cancel" cssClass="btnbg" formIds="carEntryForm" href = "cancelCarEntry.action" targets="carEntryDiv"/>
			<td style="width: 80%"></td>
			
		
		</tr>
		</table>
</div>
</s:form>

<p><a href="<s:url action='login'/>">Home</a></p>
</sj:div>
</body>
</html>